#! /bin/bash

baseDir=$(dirname "$0")

saveRequest="$(head -n 1 "$baseDir"/phost.txt)"
headerStr="$(head -n 1 "$baseDir"/pheader.txt)"

# TODO: Curl argument too long
# body="$(cat "$baseDir"/bodySave.json)"
# curl --location "$saveRequest/api/cityos/form-template/template/saveVersion" \
#   --header 'Content-Type: application/json' \
#   --header "Authorization: $headerStr" \
#   --data "$body"

# -d @- : 这里-d指明请求体，@-代表从管道里面获取数据
cat "$baseDir"/tes1/resGet-zy.json | curl --location "$saveRequest/api/cityos/form-template/template/saveVersion" \
  --header 'Content-Type: application/json' \
  --header "Authorization: $headerStr" \
  -d @-
